<template>
  <div class="Bar-Chart" ref="BarChart"></div>
</template>

<script lang="ts">
export default {
  name: "BarChart",
};
</script>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
import * as echarts from "echarts";

const BarChart = ref();

onMounted(() => {
  const myEcharts = echarts.init(BarChart.value);
  const option = {
    xAxis: {
      data: [
        "一月",
        "二月",
        "三月",
        "四月",
        "五月",
        "六月",
        "七月",
        "八月",
        "九月",
        "十月",
        "十一月",
        "十二月",
      ],
      // 坐标轴左右留白
      boundaryGap: false,
    },
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "line",
      },
    },
    yAxis: {
      // 隐藏
      show: false,
    },
    // tooltip: {},
    series: {
      name: "实施交易量",
      type: "bar",
      data: [25, 15, 46, 20, 14, 35, 15, 46, 20, 34, 34, 13],
      itemStyle: {
        color: "#3193d4",
      },
    },
    grid: {
      top: 0,
      bottom: 0,
      left: 10,
      right: 10,
    },
  };
  myEcharts.setOption(option);
});
</script>

<style scoped>
.Bar-Chart {
  height: 50px;
}
</style>
